export function PromiseTo() {
  return function (target: any, propertyKey: string, descriptor: PropertyDescriptor) {
    const oldMethod = descriptor.value
    console.log(descriptor.value)
    descriptor.value = to(oldMethod)
  };
}

export function to(promise: Promise<any[]>): Promise<any[]> {
  return promise.then((data: any) => {
     return [null, data];
  })
  .catch((err: any) => [err]);
}

